<?php

class Application_Model_Devinfo extends Zend_Db_Table_Abstract
{
    protected $_name = "kp_dev_info"; //Ten bang
    protected $_primary = "app_id"; //Khoa chinh
    protected $db;
    //Cac truong du lieu
    var $user_id;
    var $dev_id;
    var $dev_name;
    var $dev_type;
    var $dev_address;
    var $dev_country_id;
    
    //Ham khoi tao
    public function __construct(){
        $this->db = Zend_Registry::get('db');
    }
    
    //Get all user
    public function getAll(){
        $query = $this->db->select();
        $query->from($this->_name);
        $query->order(array('dev_name'));
        return $this->db->fetchAll($query);
    }
    
    //Them mới user
    public function insertNew(){
        $data = array(
                'dev_id' => $this->dev_id,
                'dev_name' => $this->dev_name,
                'dev_type'=>$this->dev_type,
                'dev_address'=>$this->dev_address,
                'dev_country_id'=>$this->dev_country_id,
        );
        //var_dump($data); die;
        return $this->db->insert($this->_name,$data);
    }

}

